import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home/Home.vue'

const routes = [
  {
    path: '/films',
    name: 'Home',
    component: Home,
    children:[
      {
        path:"inTheaters",
        component: () => import('../views/Films/inTheaters.vue')
      },{
        path:"comingSoon",
        component: () => import('../views/Films/comingSoon.vue')
      }
    ]
  },
  {
    // 路由重定向
    path: '/',
   redirect:"/films/inTheaters"
  },{
    path:"/detail",
    component: () => import('../views/Detail/index.vue')
  },
  {
    path:"/city",
    component: () => import('../views/City/index.vue')
  },
  {
    path:"/music",
    component: () => import('../views/Music/index.vue')
  },
  {
    path:"/:pathMatch(.*)",
    component: () => import('../views/ErrorPage/index.vue')
  }
]
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
export default router
